from pydantic import BaseModel, Field, ConfigDict
from typing import List, Optional

class UserCreate(BaseModel):
    ...
    
class UserUpdate(BaseModel):
    ...
    
class UserSchema(BaseModel):
    username: str
    password: str
    sex: int
    userType: int             = Field(alias='user_type')
    alias: str
    email: str
    phone: str
    status: int
    loginIp: Optional[str]    = Field(None, alias='login_ip')
    loginDate: Optional[str]  = Field(None, alias='login_date')
    avatar: str
    remark: str
    roles: List = []
    createdAt: str = Field(alias='created_at')
    updatedAt: str = Field(alias='updated_at')
    createdBy: str = Field(alias='created_by')
    updatedBy: str = Field(alias='updated_by')
    
    model_config = ConfigDict(
        populate_by_name=True,
        from_attributes=True
    )